package main

import (
	"sync"
	"syscall"

	"github.com/judwhite/go-svc/svc"
	"github.com/my/repo/NSQ学习/rewriteCode/internal/lg"
	"github.com/my/repo/NSQ学习/rewriteCode/nsqd"
)

//使用"github.com/judwhite/go-svc/svc"包来管理服务
//nsqd核心服务结构,必须实现init，start和stop方法
type program struct {
	once sync.Once
	nsqd *nsqd.NSQD
}

func main() {
	prg := &program{}
	if err := svc.Run(prg, syscall.SIGINT, syscall.SIGTERM); err != nil {
		logFatal("%s", err)
	}
}

func logFatal(f string, args ...interface{}) {
	lg.LogFatal("[nsqd] ", f, args...)
}
